from dataclasses import dataclass, field
from functools import total_ordering, lru_cache


@dataclass
@total_ordering
class Node:
    addr: int = field()
    value: int
    n_addr: int = -1

    def __eq__(self, other):
        return self.value == other.value

    def __lt__(self, other):
        return self.value < other.value

    def __add__(self, other):
        if isinstance(other, Node):
            return Node(-1, self.value + other.value, -1)
        elif isinstance(other, int):
            return Node(-1, self.value + other, -1)
        else:
            raise TypeError(f"unsupported operand type(s) for +: '{type(self)}' and '{type(other)}'")



a, b, c = Node(1, 2, 3), Node(1, 2, 3), Node(1, 2, 3)

print(sum([a, b, c]))
